﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using SDM.ExamPlanner.BLL;
using SDM.ExamPlanner.DTO;

namespace SDM.ExamPlanner.Test
{
    [TestClass]
    public class SchoolClassManagerExtensionsTest
    {
        [TestMethod]
        public void CalcSemesterTest()
        {
            // Assign
            var schoolClass = TestObjects.SchoolClassObject1();
            var thisYear = DateTime.Now;
            int year = thisYear.Year;

            // Act
            String newYear = "01/09/" + (year - 2);
            schoolClass.StartDate = DateTime.Parse(newYear);
            DateTime oldYear = DateTime.Parse(newYear);
            int calcSemester = new Manager<SchoolClass>().CalculateSemester(schoolClass);
            
            // Assert
            Assert.AreEqual(thisYear.Month < 9 ? 4 : 5, calcSemester);
        }
    }
}
